#ifndef _DISK_DEV_BASE_H_
#define _DISK_DEV_BASE_H_

#include <stdint.h>
#define	DISK_RDONLY     0x00  //只读模式
#define DISK_WRONLY	    0x01  //只写模式
#define DISK_RDWR		0x02  //读写模式

class CDiskDevBase
{
public:
	CDiskDevBase();
	~CDiskDevBase();
 	virtual int Open(const char * device, int acess_mod) = 0;
	virtual int Close() = 0;
	virtual int Write(uint64_t lba, unsigned char* data_buf, uint32_t data_size, bool bLock = true) = 0;
	virtual int Read(uint64_t lba, unsigned char* data_buf, uint32_t data_size, bool bLock = true) = 0;
	virtual int Flush() = 0;
	
	uint64_t GetCapacity()
	{
		return m_capacity;
	}
protected:
	char*    m_device;
	int      m_fd;         //设备句柄
	int      m_devname_len;
	uint32_t m_sec_size;
	uint64_t m_capacity;
};

#endif